﻿#include "TestPlugin1Activator.h"
#include "TestPlugin1Service.h"

#include "CPF/CPFRegisterService.h"

TestPlugin1Activator::TestPlugin1Activator()
    : m_pService(nullptr)
{
    // Activator构造函数:必须添加的宏 -- 4
    CPF_SET_INSTANCE(&cpf_create_instance);
}

TestPlugin1Activator::~TestPlugin1Activator()
{

}

bool TestPlugin1Activator::start(void)
{
    m_pService = new TestPlugin1Service();

    CPFRegisterService::instance()->registerObject<TestPlugin1Service>(m_pService);

    return true;
}

bool TestPlugin1Activator::stop(void)
{
    const type_info& info = typeid(TestPlugin1Service);
    CPFRegisterService::instance()->unregisterObject(info.name());

    delete m_pService;
    m_pService = nullptr;

    return true;
}

std::string TestPlugin1Activator::name(void)
{
    return "TestPlugin1Activator";
}

std::string TestPlugin1Activator::version(void)
{
    return "TestPlugin1Activator V1.0.0.0";
}
